package com.qwz.failover.template;

import com.qwz.failover.LogStrategy;

import java.text.SimpleDateFormat;
import java.util.Date;
/**  
* @Description: 实现日志策略的抽象模板，实现为消息添加时间
* @Package com.qwz.failover.template.LogStrategyTemplate
* @author Qiuwuzhi
* @date 2019/12/25 15:31
* @version V1.0
*/
public abstract class LogStrategyTemplate implements LogStrategy {
    public void log(String msg) {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        //添加时间
        msg = dateFormat.format(new Date())+"内容是:"+msg;
        //真正执行日志记录
        doLog(msg);
    }

    public abstract void doLog(String msg);
}
